{
 "cells": [
  {
   "cell_type": "code",
   "id": "initial_id",
   "metadata": {
    "collapsed": true,
    "jupyter": {
     "is_executing": true
    },
    "ExecuteTime": {
     "start_time": "2025-01-23T11:42:25.026547Z"
    }
   },
   "source": [
    "#导入cv模块\n",
    "import cv2 as cv\n",
    "\n",
    "#读取图片\n",
    "img = cv.imread('zidane.jpg')\n",
    "\n",
    "#坐标 定义了矩形和圆形的位置和大小。x和y是矩形左上角的坐标，w和h分别是矩形的宽度和高度。\n",
    "x,y,w,h=100,100 ,100,100\n",
    "#绘制矩形 矩形的左上角坐标为(x, y)，右下角坐标为(x+w, y+h)\n",
    "cv.rectangle(img,(x,y,x+w,y+h),color=(0,0,255),thickness=1)\n",
    "#绘制圆形 圆心坐标为(x+w, y+h)，半径是 100 像素\n",
    "cv.circle(img,center=(x+w,y+h),radius=100,color=(255,0,0),thickness=2)\n",
    "\n",
    "#显示\n",
    "cv.imshow('re_img',img)\n",
    "\n",
    "#等待 0是无限等待下去，waitkey（）参数是等待的时间\n",
    "while True:\n",
    "    if ord('q') == cv.waitKey(0):#检测到q退出\n",
    "        break\n",
    "\n",
    "#释放内存\n",
    "cv.destroyAllWindows()"
   ],
   "outputs": [],
   "execution_count": null
  },
  {
   "metadata": {},
   "cell_type": "code",
   "outputs": [],
   "execution_count": null,
   "source": "",
   "id": "1f0e7adbe657b39f"
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
